﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Drawing.Imaging;
using System.Diagnostics;

using System.Threading;
namespace VisualCrypto
{


   public class Utility
   {
       #region PixelTranslations
       public static byte[][][] BlackPixelTranslation1 = new byte[][][]
        {
            new byte[][]
            {
                new byte[]{1, 0},
                new byte[]{1, 0}
            },

            new byte[][]
            {
                new byte[]{0, 1},
                new byte[]{0, 1}
            }
        };

       public static byte[][][] BlackPixelTranslation2 = new byte[][][]
        {
            new byte[][]
            {
                new byte[]{0, 1},
                new byte[]{0, 1}
            },

            new byte[][]
            {
                new byte[]{1, 0},
                new byte[]{1, 0}
            }
        };

       public static byte[][][] WhitePixelTranslation1 = new byte[][][]
        {
            new byte[][]
            {
                new byte[]{1, 0},
                new byte[]{1, 0}
            },

            new byte[][]
            {
                new byte[]{0, 1},
                new byte[]{0, 1}
            }
        };

       public static byte[][][] WhitePixelTranslation2 = new byte[][][]
        {
            new byte[][]
            {
                new byte[]{1, 0},
                new byte[]{1, 0}
            },

            new byte[][]
            {
                new byte[]{0, 1},
                new byte[]{0, 1}
            }
        };

       #endregion


       public static Bitmap make_bw(Bitmap original)
        {

            Bitmap output = new Bitmap(original.Width, original.Height);

            for (int i = 0; i < original.Width; i++)
            {

                for (int j = 0; j < original.Height; j++)
                {

                    Color c = original.GetPixel(i, j);

                    int average = ((c.R + c.B + c.G) / 3);

                    if (average < 200)
                        output.SetPixel(i, j, Color.Black);

                    else
                        output.SetPixel(i, j, Color.Transparent);

                }
            }

            return output;

        }




    }
}
